<template>
  <u-tabbar @change="change" inactiveColor="#999" activeColor="#EE7F33" class="custom-tabbar">
    <u-tabbar-item v-for="item in tabbar" :text="item.text" :key="item.pagePath" @click="onChange" >
      <image
			class="u-page__item__slot-icon"
			slot="active-icon"
			:src="item.selectedIconPath"
		></image>
		<image
			class="u-page__item__slot-icon"
			slot="inactive-icon"
			:src="item.iconPath"
		></image>
    </u-tabbar-item>
  </u-tabbar>
</template>

<script>
export default {
  name: 'CustomTabbar',
  data() {
    return {
      tabbar: [
        {
          pagePath: 'pages/home/index',
          text: '首页',
          iconPath: require('../../static/tabbar/home_default.png'),
          selectedIconPath: require('../../static/tabbar/home_selected.png')
        },
        {
          pagePath: 'pages/home/watch',
          text: '追剧',
          iconPath: require('../../static/tabbar/watch_default.png'),
          selectedIconPath: require('../../static/tabbar/watch_selected.png')
        },
        {
          pagePath: 'pages/videoWebView/recommend',
          text: '推荐',
          iconPath: require('../../static/tabbar/recommend_default.png'),
          selectedIconPath: require('../../static/tabbar/recommend_selected.png')
        },
        {
          pagePath: 'pages/home/user',
          text: '我的',
          iconPath: require('../../static/tabbar/user_default.png'),
          selectedIconPath: require('../../static/tabbar/user_selected.png')
        }
      ]
    }
  },
  methods: {
    onChange(e){
      console.log(e,'onChange');
    }
  },
  components: {}
}
// "tabBar": {
//     "color": "#999",
//     "selectedColor": "#EE7F33",
//     "backgroundColor": "#000",
//     "borderStyle": "#000",
//     "list": [
//       {
//         "pagePath": "pages/home/index",
//         "text": "首页",
//         "iconPath": "static/tabbar/home_default.png",
//         "selectedIconPath": "static/tabbar/home_selected.png"
//       },
//       {
//         "pagePath": "pages/home/watch",
//         "text": "追剧",
//         "iconPath": "static/tabbar/watch_default.png",
//         "selectedIconPath": "static/tabbar/watch_selected.png"
//       },
//       {
//         "pagePath": "pages/videoWebView/recommend",
//         "text": "推荐",
//         "iconPath": "static/tabbar/recommend_default.png",
//         "selectedIconPath": "static/tabbar/recommend_selected.png"
//       },
//       {
//         "pagePath": "pages/home/user",
//         "text": "我的",
//         "iconPath": "static/tabbar/user_default.png",
//         "selectedIconPath": "static/tabbar/user_selected.png"
//       }
//     ]
//   }
</script>

<style >
.u-tabbar__content{
  background: #000 !important;
}
.u-page__item__slot-icon{
  width: 42rpx;
  height: 42rpx;
}
</style>
